const express = require('express')
const auditController = require('../controllers/auditController')
const { authenticateToken } = require('../middlewares/authMiddleware')
const {checkPermission, checkPermissionLevel } = require('../middlewares/permissionMiddleware')
const router = express.Router()

// 所有路由都需要认证Token
router.use(authenticateToken)


// 获取审计日志列表
router.get('/logs', checkPermission('operlog:list'), checkPermissionLevel(40), auditController.getAuditLogs)

// 获取审计日志详情
router.get('/log/:id', checkPermission('operlog:view'), checkPermissionLevel(40), auditController.getAuditLogDetail)

// 在线用户
router.get('/online/users', checkPermission('online:list'), checkPermissionLevel(40), auditController.getOnlineUsers)

// 获取统计信息
router.get('/statistics', auditController.getStatistics)


module.exports = router